package com.lk.web.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 权限表
 *
 * @author Aspirin
 * @since 2020-06-21
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SysPermission implements Serializable {
  private static final long serialVersionUID = 1L;
  /** 权限 ID */
  @TableId(value = "id", type = IdType.AUTO)
  private Long id;
  /** 父权限 ID (0为顶级菜单) */
  private Long parentId = 0L;
  /** 权限名称 */
  private String name;
  /** 授权标识符 */
  private String code;
  /** 授权路径 */
  private String url;
  /** 类型(1菜单，2按钮) */
  private Integer type;
  /** 图标 */
  private String icon;
  /** 备注 */
  private String remark;

  private LocalDateTime createDate;
  private LocalDateTime updateDate;

  /** 用于新增和修改页面上默认的根菜单名称 */
  @TableField(exist = false)
  private String parentName = "根菜单";

  /** 所有子权限对象集合 左侧菜单渲染时要用 */
  @TableField(exist = false)
  private List<SysPermission> children;

  /** 所有子权限 URL 集合 左侧菜单渲染时要用 */
  @TableField(exist = false)
  private List<String> childrenUrl;
}
